On Jones-Optimal Specialization for Strongly Typed Languages
نویسنده
چکیده
The phrase \optimal program specialization" was de ned by Jones et al. in 1993 to capture the idea of a specializer being strong enough to remove entire layers of interpretation. As it has become clear that it does not imply \optimality" in the everyday meaning of the word, we propose to rename the concept \Jones-optimality". We argue that the 1993 de nition of Jones-optimality is in principle impossible to ful l for strongly typed languages due to necessary encodings on the inputs and outputs of a well-typed self-interpreter. We propose a technical correction of the de nition which allows Jones-optimality to remain a meaningful concept for typed languages. We extend recent work by Hughes and by Taha and Makholm on the long-unsolved problem of Jones-optimal specialization for strongly typed languages. The methods of Taha and Makholm are enhanced to allow \almost optimal" results when a self-interpreter is specialized to a typeincorrect program; how to do this has been an open problem since 1987. Neither Hughes' nor Taha{Makholm's methods are by themselves su cient for Jones-optimal specialization when the language contains primitive operations that produce or consume complex data types. A simple postprocess is proposed to solve the problem. An implementation of the proposed techniques has been produced and used for the rst successful practical experiments with truly Jones-optimal specialization for strongly typed languages.
منابع مشابه
Tag Elimination and Jones-Optimality
Tag elimination is a program transformation for removing unnecessary tagging and untagging operations from automatically generated programs. Tag elimination was recently proposed as having immediate applications in implementations of domain specific languages (where it can give a two-fold speedup), and may provide a solution to the long standing problem of Jones-optimal specialization in the ty...
متن کاملType-Safe Compilation of Covariant Specialization: A Practical Case
Despite its lack of type safety, some typed object-oriented languages use covariant specialization for methods. In this work, we show how one may modify the semantics of languages that use covariant specialization in order to improve their type safety. We demonstrate our technique using O2, a strongly and statically typed object-oriented database programming language which uses covariant specia...
متن کاملRemoving Value Encoding Using Alternative Values in Partial Evaluation of Strongly-Typed Languages
There is a main diierence between a program which is interpreted by an interpreter written in a strongly-typed language and a compiled version. Such an interpreter usually uses a universal domain for the values it manipulates. A value encoding is necessary. A compiled program works directly on values. A layer of interpretation for value representation is inserted. On the other hand, a way to de...
متن کاملEfficient Just-In-Time Execution of Dynamically Typed Languages Via Code Specialization Using Precise Runtime Type Inference
Dynamically typed languages such as JavaScript present a challenge to just-in-time compilers. In contrast to statically typed languages such as JVML, in which there are specific opcodes for common operations on primitive types (such as iadd for integer addition), all operations in dynamically typed language such as JavaScript are late-bound. Often enough, types cannot be inferred with certainty...
متن کاملInstance variables specialization in object-oriented programming
One of the most bothering restrictions of statically typed objectoriented languages is that the type of mutable instance variables, cannot be specialized in a subclass. This restriction is in practice so vexing that some commercial object-oriented languages have preferred to give up static type safety rather than to adopt it. In this paper we propose the first general and uniform technique to o...
متن کامل